<template>
  <ul class="treeMenu">
    <li v-for="(item, index) in list" :key="index">
      <!-- <p @click="duoxuan(item.menuId)">{{ item.name }}</p> -->
      <el-checkbox v-model="checkAll" :label="item.menuId">{{
        item.name
      }}</el-checkbox>
      <treeMenus :list="item.children"></treeMenus>
    </li>
  </ul>
</template>
<script>
import datas from "./data";
export default {
  name: "treeMenus",
  props: {
    list: Array,
  },
  data() {
    return {
      checkAll: datas.state.tokenUser || Array,
    };
  },
  methods: {},
  mounted() {
    setInterval(() => {
      this.checkAll = datas.state.tokenUser;
    }, 100);
  },
  watch: {
    checkAll(i) {
      datas.tokenUsers(i);
    },
  },
};
</script>
<style>
.treeMenu {
  padding-left: 40px !important;
}
.treeMenu li {
  margin-bottom: 10px !important;
}
</style>